<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual describes GNU Stow version 2.3.1
(28 July 2019), a program for managing farms of symbolic links.

Software and documentation is copyrighted by the following:

(C) 1993, 1994, 1995, 1996 Bob Glickstein <bobg+stow@zanshin.com>


(C) 2000, 2001 Guillaume Morin <gmorin@gnu.org>


(C) 2007 Kahlil (Kal) Hodgson <kahlil@internode.on.net>


(C) 2011 Adam Spiers <stow@adamspiers.org>

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.


Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled "GNU General Public License" is included with the
modified manual, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the Free Software Foundation. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Perl and Perl 5 Modules (Stow)</title>

<meta name="description" content="Perl and Perl 5 Modules (Stow)">
<meta name="keywords" content="Perl and Perl 5 Modules (Stow)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index.html#Index" rel="index" title="Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Compile_002dtime-vs-Install_002dtime.html#Compile_002dtime-vs-Install_002dtime" rel="up" title="Compile-time vs Install-time">
<link href="Bootstrapping.html#Bootstrapping" rel="next" title="Bootstrapping">
<link href="Cygnus-Software.html#Cygnus-Software" rel="prev" title="Cygnus Software">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<a name="Perl-and-Perl-5-Modules"></a>
<div class="header">
<p>
Previous: <a href="Cygnus-Software.html#Cygnus-Software" accesskey="p" rel="prev">Cygnus Software</a>, Up: <a href="Compile_002dtime-vs-Install_002dtime.html#Compile_002dtime-vs-Install_002dtime" accesskey="u" rel="up">Compile-time vs Install-time</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Perl-and-Perl-5-Modules-1"></a>
<h3 class="section">12.5 Perl and Perl 5 Modules</h3>

<p>Perl 4.036 allows you to specify different locations for installation
and for run-time.  It is the only widely-used package in this author&rsquo;s
experience that allows this, though hopefully more packages will adopt
this model.
</p>
<p>Unfortunately, the authors of Perl believed that only AFS sites need
this ability.  The configuration instructions for Perl 4 misleadingly
state that some occult means are used under AFS to transport files from
their installation tree to their run-time tree.  In fact, that confusion
arises from the fact that Depot, Stow&rsquo;s predecessor, originated at
Carnegie Mellon University, which was also the birthplace of AFS.  CMU&rsquo;s
need to separate install-time and run-time trees stemmed from its use of
Depot, not from AFS.
</p>
<p>The result of this confusion is that Perl 5&rsquo;s configuration script
doesn&rsquo;t even offer the option of separating install-time and run-time
trees <em>unless</em> you&rsquo;re running AFS.  Fortunately, after you&rsquo;ve
entered all the configuration settings, Perl&rsquo;s setup script gives you
the opportunity to edit those settings in a file called
<samp>config.sh</samp>.  When prompted, you should edit this file and replace
occurrences of
</p>
<div class="example">
<pre class="example">inst<span class="roman">&hellip;</span>/usr/local<span class="roman">&hellip;</span>
</pre></div>

<p>with
</p>
<div class="example">
<pre class="example">inst<span class="roman">&hellip;</span>/usr/local/stow/perl<span class="roman">&hellip;</span>
</pre></div>

<p>You can do this with the following Unix command:
</p>
<div class="example">
<pre class="example">sed 's,^\(inst.*/usr/local\),\1/stow/perl,' config.sh &gt; config.sh.new
mv config.sh.new config.sh
</pre></div>

<p>Hopefully, the Perl authors will correct this deficiency in Perl 5&rsquo;s
configuration mechanism.
</p>
<p>Perl 5 modules&mdash;i.e., extensions to Perl 5&mdash;generally conform to a set
of standards for building and installing them.  The standard says that
the package comes with a top-level <samp>Makefile.PL</samp>, which is a Perl
script.  When it runs, it generates a <samp>Makefile</samp>.
</p>
<p>If you followed the instructions above for editing <samp>config.sh</samp> when
Perl was built, then when you create a <samp>Makefile</samp> from a
<samp>Makefile.PL</samp>, it will contain separate locations for run-time
(<samp>/usr/local</samp>) and install-time (<samp>/usr/local/stow/perl</samp>).
Thus you can do
</p>
<div class="example">
<pre class="example">perl Makefile.PL
make
make install
</pre></div>

<p>and the files will be installed into <samp>/usr/local/stow/perl</samp>.
However, you might prefer each Perl module to be stowed separately.  In
that case, you must edit the resulting Makefile, replacing
<samp>/usr/local/stow/perl</samp> with <samp>/usr/local/stow/<var>module</var></samp>.
The best way to do this is:
</p>
<div class="example">
<pre class="example">perl Makefile.PL
find . -name Makefile -print | \
  xargs perl -pi~ -e 's,^(INST.*/stow)/perl,$1/<var>module</var>,;'
make
make install
</pre></div>

<p>(The use of &lsquo;<samp>find</samp>&rsquo; and &lsquo;<samp>xargs</samp>&rsquo; ensures that all Makefiles in
the module&rsquo;s source tree, even those in subdirectories, get edited.)  A
good convention to follow is to name the stow directory for a Perl
<var>module</var> <samp>cpan.<var>module</var></samp>, where &lsquo;<samp>cpan</samp>&rsquo; stands for
Comprehensive Perl Archive Network, a collection of FTP sites that is
the source of most Perl 5 extensions.  This way, it&rsquo;s easy to tell at a
glance which of the subdirectories of <samp>/usr/local/stow</samp> are Perl 5
extensions.
</p>
<p>When you stow separate Perl 5 modules separately, you are likely to
encounter conflicts (see <a href="Conflicts.html#Conflicts">Conflicts</a>) with files named <samp>.exists</samp>
and <samp>perllocal.pod</samp>.  One way to work around this is to remove
those files before stowing the module.  If you use the
<samp>cpan.<var>module</var></samp> naming convention, you can simply do this:
</p>
<div class="example">
<pre class="example">cd /usr/local/stow
find cpan.* \( -name .exists -o -name perllocal.pod \) -print | \
  xargs rm
</pre></div>


<hr>
<div class="header">
<p>
Previous: <a href="Cygnus-Software.html#Cygnus-Software" accesskey="p" rel="prev">Cygnus Software</a>, Up: <a href="Compile_002dtime-vs-Install_002dtime.html#Compile_002dtime-vs-Install_002dtime" accesskey="u" rel="up">Compile-time vs Install-time</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
